﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessObject;
using Model;

namespace ViewLayer.Pages.Projetos
{
    public partial class InicioProjeto : System.Web.UI.Page
    {
        User user;
        Project projeto;

        protected void Page_Load(object sender, EventArgs e)
        {
            user = (User)Session["User"];
            if (user == null)
            {
                Response.Redirect("../Account/Login.aspx");
            }

            if (!IsPostBack)
            {
                if (Session["Project"] != null)
                {
                    this.projeto = Session["Project"] as Project;
                    this.lblNomeProjeto.Text = projeto.Nome;
                    this.lblDataInicioProjeto.Text = projeto.DataInicio.ToString("dd/MM/yyyy");
                    this.lblDataFimProjeto.Text = projeto.DataFim.ToString("dd/MM/yyyy");
                }
            }
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (uploadProjeto.HasFile)
            {
                EpicBO.Instance.Import(uploadProjeto.PostedFile, Session["Project"] as Project);
            }
        }

        //protected void btnRelease_Click(object sender, EventArgs e)
        //{
        //    Response.Redirect("../Releases/CadastroRelease.aspx");
        //}

        protected void btnSimulate_Click(object sender, EventArgs e)
        {
            Response.Redirect("../MonteCarlo/Simulacao.aspx");
        }  
    }
}